package com.qf.controller;

import com.qf.ex.UserException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/ex")
public class ExController {

    @GetMapping("/test3")
    public String test3(String name) throws UserException {
        if (name==null||"".equals(name)){
            throw new UserException("用户名不存在");
        }

        return "";
    }

    @RequestMapping("/test1")
    public String test1(){

        String s = null;
        System.out.println(s.length());
        return s;

    }

    @RequestMapping("/test2")
    public String test2(){

        int[] ints = new int[10];
        ints[20] = 100;
        System.out.println(123);
        return "ok";
    }

}
